/**
 * 测试构造器重载
 */

public class User {
    int id;
    String name;
    String pwd;
    //无参的构造器，名字必须与类名相同
    public User(){

    }
    //有参的构造器，名字必须与类名相同,参数之间用逗号隔开
    public User (int id,String name){
        //第一个必须是this开头
        this.id = id;//this用来确认是上面的id
        this.name = name;
    }
    public User(int id, String name, String pwd) {
        this.id = id;
        this.name = name;
        this.pwd = pwd;
    }

    public static void main(String[] args) {
        User u = new User();
        User u1 = new User(131,"华仔");
        User u2 = new User(126,"华少","123323");
        System.out.println(u1);
        System.out.println(u2);
        System.out.println(u1.id);
        System.out.println(u2.name);
    }
}

